<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <meta name="format-detection" content="telephone=no">
  <meta http-equiv="x-rim-auto-match" content="none">
  <title>支付宝付款</title>
  <script src="${request.contextPath}/statics/js/jquery.js"></script>
  <script src="${request.contextPath}/statics/js/qrcode.min.js"></script>
  <script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>
  <style>
    * {
      padding: 0;
      margin: 0;
    }
    a {
      text-decoration: none;
    }
    .clearfix1:after {
      content: '';
      height: 0;
      line-height: 0;
      visibility: hidden;
      display: block;
      clear: both;
    }

    .clearfix1 {
      zoom: 1;
    }

    html, body {
      background-color: #EDEDED;
    }
      .page {
        width: 100%;
        margin: auto;
        background-color: #EDEDED;
      }
      .header {
        position: relative;
        text-align: center;
        height: 50px;
        line-height: 50px;
        margin-top: 15px;
        padding: 0;
      }
      .header .img {
        width: 30%; display: inline-block;
      }
      .header img {
      	width: 100%;
      	vertical-align: middle;
    	}
     .main div {
     	padding-left: 50px;
    	text-align: left;
    }
    .main .order {
      margin: 8px auto;
      font-size: 18px;
      color: #000;
      font-family: PingFangSC-Medium;
    }
      .main .money {
        margin: 8px auto;
         color: #ff0000;
      font-size: 18px;
      }
    
      .main .order {
        font-size: 18px;
      }
      .main .time {
    	margin:8px auto;
        height: 28px;
        font-size: 18px;
        font-family: PingFangSC-Regular; 
        display: flex;
        align-items: center;
      }
      .mob {
        display: block;
      }
      .main .txt1 {
	    letter-spacing: 1px;
	    text-align: center;
	    color: #ffffff;
	    font-family: PingFangSC-Regular;
	    border-radius: 5px;
        width: 85%;
        padding: 3% 0;
        font-size: 18px;
        margin: 0 auto 10px;
        font-weight: bold;
        background-color: #4EA5E9;
      }
      #copyshow div span {
      	line-height:1.5;
      }
</style>
</head>

<body>
<div class="header page">
  <span class="img">
      <img src="${request.contextPath}/statics/image/logo.png" alt="">
  </span>
</div>
<div class="main page">
  <div class="money">
    <span style="color:#000;">付款金额：</span><span>&yen;</span> <span id="money">${amount !''}</span>
  </div>  
  <div class="order">
             订单编号：<span id="order">${orderid !''}</span>
  </div>
  <div class="time">
      	有效时间：<span class="minute green">4</span>&nbsp;分&nbsp;<span class="second green">59</span>&nbsp;秒
  </div>
  <div class="txt1">
    <span class="mob" onclick="copy('订单金额:${applyamount !''}，实付金额:${amount !''}，付款链接:${payurl !''}')">点击复制付款链接</span>
  </div>  
  <div id="copyshow" style="overflow: hidden;  width:85%; margin: 0 auto;padding:0;text-align: center;">
       <div class="left" style="margin-top:5px;text-align:left;padding:0;">
           <p id="span1" class="warning">
           <span>操作步骤：</span> <br>
           <span>
            1、点击复制按钮，复制付款链接 <br>
            2、打开支付宝，进入支付宝通讯录，找到自己或者任一好友，粘贴并发送消息<br>
            3、点击已发送的链接就可以进行支付。</span>
           </p>
       </div>
       <img class="img" src="${request.contextPath}/statics/image/tobank.png" style="width:80%; margin: 10px auto;">
  </div>
</div>
<div id="myList1" style="border-top:1500px;"></div>
</body>

<script>
  /* 展示复制教程 */
  function copy(message) {
    $('#copyshow').slideDown();
    var input = document.createElement("input");
    input.value = message;
    document.getElementById("myList1").appendChild(input);
    input.select();
    input.setSelectionRange(0, input.value.length), document.execCommand('Copy');
    document.getElementById("myList1").removeChild(input);
    var html = '<div style="font-size:20px;">复制成功!</div><div style="color:red;">充值流程：<br>1、打开支付宝，将该信息发给任意好友，<br>2、点击发送后的链接进入付款</div>';
    layer.alert(html, {
      icon: 6,
      title: "温馨提示",
      btn:['我知道了']
    });
  }

  /*倒计时*/
  var minute = document.querySelector(".minute")
  var second = document.querySelector(".second")
  // 准备
  var countdownMinute = 10 //10分钟倒计时
  var startTimes = new Date() //开始时间
  var endTimes = new Date(startTimes.setMinutes(startTimes.getMinutes() + countdownMinute)) //结束时间
  var curTimes = new Date() //当前时间
  var surplusTimes = endTimes.getTime() / 1000 - curTimes.getTime() / 1000 //结束毫秒-开始毫秒=剩余倒计时间

  // 进入倒计时
  countdowns = window.setInterval( () => {
    surplusTimes--;
    var minu = Math.floor(surplusTimes / 60)
    var secd = Math.round(surplusTimes % 60)
    // console.log(minu+':'+secd)
    minu = minu <= 9 ? '0' + minu : minu
    secd = secd <= 9 ? '0' + secd : secd
    minute.innerHTML = minu
    second.innerHTML = secd
    // checkdata();
    if (surplusTimes <= 0) {
      alert('订单已过期,请勿支付,请重新发起订单！');
      window.history.go(-1);
      location.reload();
      clearInterval(countdowns)
    }
  },1000);
  
  var orderid = "${orderid !''}";
  setInterval(checkdata,3000);
  function checkdata(){
    $.ajax({
      type: 'GET',
      url: '${request.contextPath}/api/checkOrderStatus/'+orderid,
      dataType: 'json',
      success: function (str) {
        if (str.data == "ok") {
        	 location.href = "${request.contextPath}/api/success.html";
        }
      }
    });
  }
  
  function closeWebPage(){
	  var userAgent = navigator.userAgent;
	  if (userAgent.indexOf("Firefox") != -1 || userAgent.indexOf("Chrome") !=-1) {
	      window.location.href="about:blank";   
	  }else if(userAgent.indexOf('Android') > -1 || userAgent.indexOf('Linux') > -1){
	      window.opener=null;
	      window.open('about:blank','_self','').close(); 
	  }else {
	      window.pener = null;
	      window.open("about:blank", "_self");
	      window.close();
	  }
  }
// $('.ok').show();
</script>
</html>